// JavaScript Document
function Inint_AJAX()
{
	try
	{
		return new ActiveXObject( "Msxml2.XMLHTTP" );
	}
	catch ( e )
	{
	};

	try
	{
		return new ActiveXObject( "Microsoft.XMLHTTP" );
	}
	catch ( e )
	{
	};

	try
	{
		return new XMLHttpRequest();
	}
	catch ( e )
	{
	};

	alert( "XMLHttpRequest not supported" );
	return null;
};
function getbreed(type_id,res_id){
	
	var ran=Math.floor(Math.random()*100);
	var data="type_id=" + type_id + "&ran=" + ran;
	var req = Inint_AJAX();
	req.open( "post" , "ajax/getbreed.php" , true ); //สร้าง connection
	req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" ); // set Header
	req.send( data );
	
	req.onreadystatechange = function()
	{
		if ( req.readyState == 4 )
		{
			if ( req.status == 200 )
			{
				var res=req.responseText;
				document.getElementById(res_id).innerHTML=res;
			}
		}
	}
}
function getcustomer(cus_id,val_id,pet_res){
	window.open("ajax/getcustomer.php?res_id="+cus_id+"&val_id="+val_id+"&pet_res="+pet_res,null,"height=500,width=680,status=yes,toolbar=no,menubar=no,location=no");
}
function getpharmacy(res_id){
	window.open("ajax/getpharmacy.php?res_id="+res_id,null,"height=500,width=680,status=yes,toolbar=no,menubar=no,location=no");
}
function printbill(med_id){
	window.open("ajax/printbill.php?med_id="+med_id,null,"height=500,width=720,status=yes,toolbar=no,menubar=no,location=no");
}